package com.mdd.admin.validate.system;

import com.mdd.admin.validate.BaseParam;
import com.mdd.common.validator.annotation.IDMust;
import com.mdd.common.validator.annotation.IntegerContains;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import lombok.Data;
import javax.validation.constraints.*;

/**
 * 定时任务参数
 * @author panweiliang
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class SystemDevCrontabParam extends BaseParam {

    @IDMust(message = "id参数必传且需大于0", groups = {update.class, delete.class})
    private Integer id;

    @NotNull(message = "name参数缺失", groups = {create.class, update.class})
    @Length(max = 32, message = "name参数不能超出32个字符", groups = {create.class, update.class})
    private String name;

    @NotNull(message = "type参数缺失", groups = {create.class, update.class})
    @IntegerContains(values = {1, 0}, message = "type参数值不在符合范围", groups = {create.class, update.class})
    private Integer type;

    @IntegerContains(values = {1, 0}, message = "system参数值不在符合范围", groups = {create.class, update.class})
    private Integer system = 1;

    @Length(max = 255, message = "remark参数不能超出255个字符", groups = {create.class, update.class})
    private String remark;

    @NotNull(message = "command参数缺失", groups = {create.class, update.class})
    @Length(max = 64, message = "command参数不能超出64个字符", groups = {create.class, update.class})
    private String command;

    @Length(max = 64, message = "params参数不能超出64个字符", groups = {create.class, update.class})
    private String params;

    @NotNull(message = "status参数缺失", groups = {create.class, update.class})
    @DecimalMin(value = "0", message = "status参数值不能少于0", groups = {create.class, update.class})
    private Integer status;

    @NotNull(message = "expression参数缺失", groups = {create.class, update.class})
    @Length(max = 64, message = "expression参数不能超出64个字符", groups = {create.class, update.class})
    private String expression;

    private String error;

//    private Long lastTime;
//
//    private String time;
//
//    private String maxTime;

}
